package A2017;
import static java.lang.Math.*;
import java.util.Scanner;

public class _10_油漆问题 {
	static boolean[][] vis;
	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		int n = in.nextInt();
		vis = new boolean[10005][10005];
		while (n-- > 0) {
			int x1 = in.nextInt();
			int y1 = in.nextInt();
			int x2 = in.nextInt();
			int y2 = in.nextInt();
			paint(min(x1,x2), min(y1,y2), max(x1,x2), max(y1,y2));
		}
		int ans = 0;
		for (int i = 0; i < 10005; i++)
			for (int j = 0; j < 10005; j++)
				if (vis[i][j])
					ans++;
		System.out.println(ans);
	}
	static void paint(int x1, int y1, int x2, int y2) {
		for (int i = x1; i < x2; i++)
			for (int j = y1; j < y2; j++) {
				vis[i][j] = true;
				
			}
	}
}
